Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@wdio/runner
Advanced tools
@wdio/runner is a core package of the WebdriverIO test framework. It is responsible for running the test suite, managing the lifecycle of the WebDriver sessions, and handling the execution of test scripts. It provides a robust and flexible environment for running automated tests across different browsers and devices.
Running Test Suites
This code demonstrates how to run a test suite using the @wdio/runner package. It sets up the configuration for the test run, including the test specs, browser capabilities, log level, test framework, and reporters. The `run` function is then called with the configuration, and the process exits with the appropriate exit code based on the test results.
const { run } = require('@wdio/runner');
const config = {
specs: ['./test/specs/**/*.js'],
capabilities: [{ browserName: 'chrome' }],
logLevel: 'info',
framework: 'mocha',
reporters: ['spec'],
};
run(config).then(
(exitCode) => process.exit(exitCode),
(error) => {
console.error('Error:', error);
process.exit(1);
}
);
Managing WebDriver Sessions
This example shows how to manage WebDriver sessions using the @wdio/runner package. The configuration specifies the use of Firefox as the browser and Jasmine as the test framework. The `run` function handles the lifecycle of the WebDriver sessions, ensuring that they are properly started and terminated during the test run.
const { run } = require('@wdio/runner');
const config = {
specs: ['./test/specs/**/*.js'],
capabilities: [{ browserName: 'firefox' }],
logLevel: 'info',
framework: 'jasmine',
reporters: ['dot'],
};
run(config).then(
(exitCode) => process.exit(exitCode),
(error) => {
console.error('Error:', error);
process.exit(1);
}
);
Customizing Test Execution
This code sample demonstrates how to customize test execution using the @wdio/runner package. The configuration includes additional options for the Mocha framework, such as setting a custom timeout for the tests. The `run` function executes the tests with the specified configuration, allowing for flexible and tailored test runs.
const { run } = require('@wdio/runner');
const config = {
specs: ['./test/specs/**/*.js'],
capabilities: [{ browserName: 'chrome' }],
logLevel: 'debug',
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
timeout: 60000,
},
};
run(config).then(
(exitCode) => process.exit(exitCode),
(error) => {
console.error('Error:', error);
process.exit(1);
}
);
The selenium-webdriver package is a popular tool for browser automation. It provides a set of bindings for WebDriver, allowing you to write tests in various programming languages. Compared to @wdio/runner, selenium-webdriver offers more direct control over WebDriver sessions but requires more boilerplate code to set up and manage tests.
Cypress is an end-to-end testing framework that aims to make testing fast, easy, and reliable. It provides a rich set of features for writing and running tests, including time travel, real-time reloads, and automatic waiting. Unlike @wdio/runner, Cypress does not use WebDriver and instead runs directly in the browser, which can lead to faster and more reliable tests but may have limitations in terms of browser support.
TestCafe is a modern end-to-end testing framework that does not require WebDriver. It supports multiple browsers and provides a simple API for writing tests. TestCafe handles the test execution and browser management internally, making it easier to set up and run tests compared to @wdio/runner. However, it may not offer the same level of flexibility and control as WebdriverIO.
A WebdriverIO service that runs tests in arbitrary environments
FAQs
A WebdriverIO service that runs tests in arbitrary environments
The npm package @wdio/runner receives a total of 438,726 weekly downloads. As such, @wdio/runner popularity was classified as popular.
We found that @wdio/runner demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.